﻿/*
 * Author:xiaocong_soft
 * Blog:http://xcong.cnblogs.com
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EmitMapper;
using Xc.DataObjects;
using Xc.Domain.Entity;
using Xc.Domain.Repositories.IRepositories;
using Xc.Domain.Services;

namespace Xc.Application
{
    public class RoleModulesAppService : ApplicationService
    {
        private IRoleModulesRepository _accountModuleRepository;
        private RoleModulesService _roleModuleService;

        public RoleModulesAppService()
        {
            _accountModuleRepository = AutofacInstace.Resolve<IRoleModulesRepository>();
            _roleModuleService = AutofacInstace.Resolve<RoleModulesService>();
        }

        /// <summary>
        /// 获取菜单
        /// </summary>
        /// <param name="roleIdGuid"></param>
        /// <returns></returns>
        public List<ModuleDataObject> GetMenus(Guid roleIdGuid)
        {
            var list = _roleModuleService.GetRolePermission(roleIdGuid).ToList();
            return OperationBaseService.GetMapperData<List<Module>, List<ModuleDataObject>>(list);
        }
    }
}
